package com.wdcloud.netlibrary.util;


import com.wdcloud.netlibrary.callback.DownloadFileCallback;
import com.wdcloud.netlibrary.callback.NetWorkCallback;
import com.wdcloud.netlibrary.dispatcher.CommonDispatcher;
import com.wdcloud.netlibrary.dispatcher.DownLoadDispatcher;

/**
 */

public interface HttpEvent {

    /**
     * 异步普通网络请求（get／post）
     *
     * @param callBuilder
     * @param callback
     * @param <T>
     */
    <T> void enqueue(CommonDispatcher callBuilder, final NetWorkCallback<T> callback);

    /**
     * 异步普通网络请求（get／post）,带返回结果
     *
     * @param callBuilder
     * @param c
     * @param <T>
     */
    <T> T execute(CommonDispatcher callBuilder, Class<T> c) throws Exception;

    /**
     * 同步普通网络请求（get／post）
     * @param callBuilder
     * @param callback
     * @param <T>
     */
    <T> void execute(CommonDispatcher callBuilder, final NetWorkCallback<T> callback);

    /**
     * 文件下载
     *
     * @param callBuilder
     * @param callback
     */
    void downloadFile(final DownLoadDispatcher callBuilder, final DownloadFileCallback callback);


    /**
     * 文件断点下载
     *
     * @param callBuilder
     * @param callback
     */
    void downloadFileWithMemory(final DownLoadDispatcher callBuilder, final DownloadFileCallback callback);


    /**
     * 取消任务
     *
     * @param o
     */
    void cancel(Object o);


    /**
     * 设置cookie
     *
     * @param key
     * @param value
     */
    void setCookie(String key, String value);

}
